"""Define all available Facebook API permissions."""

AVAILABLE_PERMISSIONS = [
    'user_about_me',
    'friends_about_me',
    'user_activities',
    'friends_activities',
    'user_birthday',
    'friends_birthday',
    'user_education_history',
    'friends_education_history',
    'user_events',
    'friends_events',
    'user_groups',
    'friends_groups',
    'user_hometown',
    'friends_hometown',
    'user_interests',
    'friends_interests',
    'user_likes',
    'friends_likes',
    'user_location',
    'friends_location',
    'user_notes',
    'friends_notes',
    'user_online_presence',
    'friends_online_presence',
    'user_photo_video_tags',
    'friends_photo_video_tags',
    'user_photos',
    'friends_photos',
    'user_relationships',
    'friends_relationships',
    'user_relationship_details',
    'friends_relationship_details',
    'user_religion_politics',
    'friends_religion_politics',
    'user_status',
    'friends_status',
    'user_videos',
    'friends_videos',
    'user_website',
    'friends_website',
    'user_work_history',
    'friends_work_history',
    'email',
    'read_friendlists',
    'manage_friendlists',
    'read_insights',
    'read_mailbox',
    'read_requests',
    'read_stream',
    'xmpp_login',
    'ads_management',
    'user_checkins',
    'friends_checkins',
    'publish_stream',
    'create_event',
    'rsvp_event',
    'sms',
    'offline_access',
    'publish_checkins',
    'manage_pages',
]

PERMISSION_MAP = dict(
    [(ALL_PERMISSIONS[i], i) for i in range(len(ALL_PERMISSIONS))]
)

def enforcePermissions(perms, user):
  #Find out which permissions are missing
  missing = user.checkPermissions(perms)
  
  # Push the user into a dialog requesting those permissions
  redirect_url = core.url.Url()
  redirect_url.setDomain(settings.)
  dialog_url = core.url.Url()
  dialog_url.setDomain('www.facebook.com')
  dialog_url.setPath('/dialog/oauth/')
  dialog_url.addQueryData('client_id', settings.APP_ID)
  dialog_url.addQueryData('response_type', 'token')
  dialog_url.addQueryData('state', '')
  dialog_url.addQueryData('redirect_uri', )
  